﻿@model List<KRM.Core.KRMSP_GetFAQInfoByFilter_Result>
@{
    if (@Request["isProductOnly"]=="1")
    {
        ViewBag.Title = "Viewing FAQs related to Product:" + ViewBag.ProductName;
    }
    else {ViewBag.Title = "Viewing FAQs";}
    Layout = "~/Views/Shared/_PopupLayout.cshtml";
}
<div id="EditFAQModal" class="modal hide fade in" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none;" data-width="800">
    <form action="/orderview/editfaqs" method="POST" id="frEditFAQs" style="margin: 0">  
    </form>
</div>
<div style="padding: 10px">
    <div class="row-fluid" id="msg-ViewFAQs"  style="max-height: 36px">@Html.Partial("Partial/_MessageResult")</div>
    <fieldset>
        <legend>
            Filter displayed FAQs
        </legend>
        <form action="/orderview/viewfaqs" method="GET" id="frFilterFAQs" style="margin:0">
            <input type="hidden" name="isProductOnly" value="@Request["isProductOnly"]"/>
            <input type="hidden" name="selectedChangeName" id="selectedChangeName" value=""/>
            <div class="row-fluid" >
                <div class="span2">
                    <label class='inline' for="">Supplier</label>
                    @Html.DropDownList("CompanyID",null,new{ @onchange="$('#selectedChangeName').val('CompanyID');this.form.submit()" ,@class="input-block-level"})
                </div>
                <div class="span2">
                    <label class='inline' for="">Store</label>
                    @Html.DropDownList("SiteId",null,new{ @onchange="$('#selectedChangeName').val('SiteId');this.form.submit()" ,@class="input-block-level"})
                </div>
                <div class="span2">
                    <label class='inline' for="">Product</label>
                    @Html.DropDownList("ProductId",null,new{ @onchange="$('#selectedChangeName').val('ProductId');this.form.submit()" ,@class="input-block-level"})
                </div>
                <div class="span2">
                <label class='inline' for="">Question Type</label>
                    @Html.DropDownList("QuestionType",null,new{ @onchange="this.form.submit()" ,@class="input-block-level"})

                </div>
                <div class="span2">
                    <label class='inline' for="">Displayed On Site</label>
                    @Html.DropDownList("DisplayedOnSite",null,new{ @onchange="this.form.submit()" ,@class="input-block-level"})

                </div>
                <div class="span2">
                    <label class='inline' for="">Moderation Status</label>
                    @Html.DropDownList("ModerationStatus",null,new{ @onchange="this.form.submit()" ,@class="input-block-level"})

                </div>
            </div>
            <div class="row-fluid">
                <div class="span2">
                    <label class='inline' for="">Moderated By</label>
                    @Html.DropDownList("UserId",null,new{ @onchange="this.form.submit()" ,@class="input-block-level"})
                </div>
                <div class="span2">
                    <label class='inline' for="SearchQuestions">Search Questions</label>
                    <input type="text" name="SearchQuestions" class="input-block-level" value="@Request["SearchQuestions"]"onchange="this.form.submit()">
                </div>
                <div class="span2">
                    <label class='inline' for="SearchAnswers">Search Answers</label>
                    <input type="text" name="SearchAnswers" class="input-block-level" value="@Request["SearchAnswers"]"onchange="this.form.submit()">
                </div>
                <div class="span2">
                    <input style="float: left;"  type="checkbox" name="FilterByDateFrom" id="FilterByDateFrom" value="1"  @(Request["FilterByDateFrom"]=="1"?"checked=checked":"")/>
                    <label class='inline' for="FilterByDateFrom">Date From</label>
                    <div id="datetimepicker2" class="input-append">
                        <input data-format="MM/dd/yyyy" type="text" name="dateFrom" placeholder="From" value="@(Request["dateFrom"]??DateTime.Now.ToString("MM/dd/yyyy"))" style="width: 76%">
                        <span class="add-on">
                            <i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar"></i>
                        </span>
                    </div>
                </div>
                <div class="span2">
                    <input style="float: left;" type="checkbox" name="FilterByDateTo"id="FilterByDateTo" value="1" @(Request["FilterByDateTo"]=="1"?"checked=checked":"")/>
                    <label class='inline' for="FilterByDateTo">Date To</label>
                    <div id="datetimepicker3" class="input-append">
                        <input data-format="MM/dd/yyyy" type="text" name="dateTo" placeholder="To" value="@(Request["dateTo"]??DateTime.Now.ToString("MM/dd/yyyy"))" style="width: 76%">
                        <span class="add-on">
                            <i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar"></i>
                        </span>
                    </div>
                </div>
                <div class="span2" style="padding-top: 25px;">
                    <button type="submit" class="btn btn-primary">Search</button>
                    <a href="/orderview/viewFAQs?isProductOnly=@Request["isProductOnly"]&productId=@Request["ProductId"]" class="btn btn-primary" id="resetFilter" onclick="">Reset Filters</a>
                </div>
            </div>
        </form>
    </fieldset>
    <fieldset>
        <legend>
            Filter results
        </legend>
        <div style="float: right">Numer of result : @Model.Count</div>
        <div class="row-fluid" style="height: 270px;overflow: auto;">
            <input type="hidden" value="0" name="SelectedFAQId" id="SelectedFAQId"/>
            <table class="table table-bordered table-fix tbl-selected" style="margin: 0px; table-layout: fixed; width: 100%;">
                <thead>
                    <tr>
                        <th>Date Placed</th>
                        <th>Company Name</th>
                        <th>Product Name</th>
                        <th>Question</th>
                        <th>Answer</th>
                        <th>Store Name</th>
                        <th>Popular Answer Number</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model)
                    {
                        <tr onclick="$('#SelectedFAQId').val(@item.faqID);">
                            <td>@item.dateplaced</td>
                            <td>@item.CompanyName</td>
                            <td>@item.ProductName</td>
                            <td>@item.Question</td>
                            <td>@item.Answer</td>
                            <td>@item.StoreName</td>
                            <td>@item.PopularAnswerNumber</td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
    </fieldset>
    <div class="row-fluid">
    <fieldset class="span4">
        <legend>
            Action
        </legend>
        <div class="row-fluid">
            <div class="span4">
                <button type="button" class="btn btn-primary" onclick="AddAnFAQ()">Add an FAQ</button>
            </div>
            <div class="span4">
                <button type="button" class="btn btn-primary" onclick="EditAnFAQ()">Edit an FAQ</button>
            </div>
            <div class="span4">
                <button type="button" class="btn btn-primary" onclick="DeleteAnFAQ()">Delete an FAQ</button>
            </div>
        </div>
    </fieldset>
        <fieldset class="span8">
            <legend>
                Other Action
            </legend>
            <div class="row-fluid">
                <div class="span3">
                    <button type="button" class="btn btn-primary" onclick="DisplayFAQ()">Display FAQ</button>
                </div>
                <div class="span3">
                    <button type="button" class="btn btn-primary" onclick="DoNotDisplayFAQ()">Do Not Display</button>
                </div>
                <div class="span3">
                    <button type="button" class="btn btn-primary" onclick="PopularAnswerFAQ()">Mark as Popular Answer</button>
                </div>
                <div class="span3">
                    <button type="button" class="btn btn-primary" onclick="NotPopularAnswerFAQ()">Not Popular Answer</button>
                </div>
            </div>
        </fieldset>
        </div>
</div>